#include <func.h>

//验证全局变量共享（子线程与主线程）
int global=100;

void* thread_func(void*p)
{
    printf("I am child thread, %d\n",global);

    return NULL;
}

int main ()
{
    pthread_t th_id;
    struct timeval start,end;
    int ret=pthread_create(&th_id,NULL,thread_func,NULL);
    THREAD_ERR_CHECK(ret,"pthread_create");
    global=200;
    printf("I am main thread \n");
    pthread_join(th_id,NULL);//类似wait，用于回收子线程
    
    return 0;

}